/* psd.t   PRODUCT STRUCTURE DELETE TRIGGER                                 */

	TRIGGER PROCEDURE FOR DELETE OF PS_MSTR.

    {mfdeclre.i }
    define new shared work-table wf_old_ps_mstr like ps_mstr.

	HK:
	do:
        if not can-find ( first dt_mstr where dt_table = "ps_mstr" and dt_type = "DEL" ) then leave HK.
        
        if not can-find ( first wf_old_ps_mstr ) then do:
            create wf_old_ps_mstr.
            if recid(wf_old_ps_mstr)= -1 then .
        end.
        
        buffer-copy ps_mstr to wf_old_ps_mstr no-error.

        for first dt_mstr no-lock where dt_table = "ps_mstr" and dt_type = "DEL" :
        
			run value(global_user_lang_dir + "hk/hktrigdel.p")
       			"wf_old_ps_mstr"		/*old buffer*/
       			""						/*new buffer*/
       			dt_table				/*table name*/
       			""						/*field name*/
       			dt_type					/*type*/
       			recid(ps_mstr)			/*key*/	
       			ps_mstr.ps_par			/*key1*/
				ps_mstr.ps_comp			/*key2*/
       			ps_mstr.ps_ref			/*key3*/
       			string(ps_mstr.ps_start)	/*key4*/
       			""						/*key5*/
       			""						/*key6*/
       			""						/*key7*/
       			""						/*key8*/
       			.
			
        end.
	end.
